
/*const webpack = require('webpack')
const webpackConfig = require('./webpack.dev.conf.js');
const compiler = webpack(webpackConfig)
const watching = compiler.watch({
}, (err, stats) => {
  // Print watch/build result here...
  console.log('我一直在监视着呢');
});
*/
const path = require('path')
const webpackConfig = require('./webpack.config.js');


const webpack = require('webpack');


const middleware = require('webpack-dev-middleware');


const compiler = webpack(webpackConfig);
var hotMiddleware = require('webpack-hot-middleware')(compiler)

const express = require('express');
const app = express();

//app.use(express.static(path.join(__dirname, "dist"))) 
app.use(middleware(compiler, {
  // webpack-dev-middleware options
  publicPath: webpackConfig.output.publicPath,
  contentBase: '/',
  hot: true,
  open: true,
  stats: {
    colors: true,
    chunks: false
  },
  quiet: true  //向控制台显示任何内容 
}));

app.use(hotMiddleware);

app.listen(3000, () => console.log('Example app listening on port 3000!'))